/**
 * 暗黑模式管理单例
 * 使用 object 关键字实现线程安全的单例
 */

fun main() {
    DarkModeManager.getDarkMode()
    DarkModeManager.getDarkMode()
    DarkModeManager.getDarkMode()

}


object DarkModeManager {
    // 当前暗黑模式开关状态
    var DarkMode: Boolean = false
fun getDarkMode() {
   DarkMode = !DarkMode
   println("当前暗黑模式状态：${if (DarkMode) "开启" else "关闭"}")

}
 
}
